home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / DevTools / eText5 / Source / eTLink.subproj / eTLinkUI.m < prev    next >
Encoding:
Text File  |  1994-10-24  |  2.6 KB  |  101 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //    FILENAME:    eTLinkUI.m 
  3. //    SUMMARY:    Implementation of link button inspectors
  4. //    SUPERCLASS:    Object
  5. //    INTERFACE:    None
  6. //    PROTOCOLS:    <Inspectable>
  7. //    AUTHOR:        Rohit Khare
  8. //    COPYRIGHT:    (c) 1994 California Institure of Technology, eText Project
  9. ///////////////////////////////////////////////////////////////////////////////
  10. //    DESCRIPTION
  11. //        Does its job running a nib and yelling at eTLink. Also registers its
  12. //    view for imageable dragtypes.
  13. ///////////////////////////////////////////////////////////////////////////////
  14. //    HISTORY
  15. //    07/03/94:    Created.
  16. ///////////////////////////////////////////////////////////////////////////////
  17.  
  18. #import "eTLink.h"
  19.  
  20. @implementation eTLinkUI
  21. - setAnnotation:newLink
  22. {    
  23.     if (theLink == newLink) return self;
  24.     [super setAnnotation:newLink];    // this is an awkward naming of the "chain" 
  25.     theLink = newLink;
  26.     [anchorForm setStringValue:[theLink anchorTitle]];
  27.     [anchorForm setTitle:[theLink anchorID]];
  28.     [docForm setStringValue:[theLink docTitle]];
  29.     [docForm setTitle:[theLink docID]];
  30.     return self;
  31. }
  32. ///////////////////////////////////
  33. + new
  34. {
  35.     static eTLinkUI *ui = nil;
  36.     
  37.     if (!ui) {
  38.         ui = [[eTLinkUI alloc] init];
  39.     }
  40.     return ui;
  41. }
  42. - init
  43. {
  44.     char        buf[MAXPATHLEN];
  45.     NXBundle   *bundle;
  46.  
  47.     [super init];
  48.     bundle = [NXBundle bundleForClass:[self class]];
  49.     if ( [bundle getPath:buf forResource:"eTLinkUI" ofType:"nib"] ) {
  50.         [NXApp loadNibFile:buf owner:self withNames:NO];
  51.     } else {
  52.         NXLogError("NIB not found: eTLinkUI");
  53.     }
  54.     linkView = [linkPanel contentView];
  55.     return self;
  56. }
  57. - free {return self;}
  58. ///////////////////////////////////
  59. #define PROP "Link Properties"
  60.  
  61. - (const NXAtom *) types
  62. {
  63.     static NXAtom *types = NULL;
  64.     
  65.     if (!types) {
  66.         int i;
  67.         const NXAtom *superTypes = [super types];
  68.         
  69.         for(i=0;superTypes[i];i++);
  70.         i++; // make room for terminating NULL
  71.         i++; // make room for our type
  72.         types = malloc(i * sizeof(NXAtom));
  73.         types[0] = NXUniqueString(PROP);
  74.         for(i=0;superTypes[i];i++) types[i+1] = superTypes[i];
  75.         types[i+1] = NULL;
  76.     }
  77.     return types;
  78. }
  79. - (const char *) inspectorTitle
  80. {
  81.     return NXUniqueString("Link");
  82. }
  83. - resignInspector: (View *) oldInspector ofType: (const char *) type
  84. {
  85.     if (oldInspector != linkView)
  86.         [super resignInspector:oldInspector ofType:type];
  87.     return self;
  88. }
  89. - activateInspector: (View *) newInspector ofType:(const char *) type
  90. {
  91.     if (newInspector != linkView)
  92.         [super activateInspector:newInspector ofType:type];
  93.     return self;
  94. }
  95. - inspectorForType:(const char *) type
  96. {
  97.     if(!strcmp(type,NXUniqueString(PROP)))
  98.         return linkView;
  99.     return [super inspectorForType:type];
  100. }
  101. @end;